﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace MediaGerbil
{
    public partial class ExpandCollapseButton : UserControl
    {
        [Browsable(true)]
        public bool Collapsed { get; set; }
        public Control CollapsingControl { get; set; }

        public ExpandCollapseButton()
        {
            InitializeComponent();
            buttonImage_MouseLeave(null, null);
        }

        private void buttonImage_MouseEnter(object sender, EventArgs e)
        {
            buttonImage.Image = Collapsed ? MediaGerbil.Properties.Resources.Down_1 : MediaGerbil.Properties.Resources.Up_1;
        }

        private void buttonImage_MouseLeave(object sender, EventArgs e)
        {
            buttonImage.Image = Collapsed ? MediaGerbil.Properties.Resources.Down_0 : MediaGerbil.Properties.Resources.Up_0;
        }

        private void buttonImage_MouseDown(object sender, MouseEventArgs e)
        {
            buttonImage.Image = Collapsed ? MediaGerbil.Properties.Resources.Down_2 : MediaGerbil.Properties.Resources.Up_2;
        }

        private void buttonImage_MouseUp(object sender, MouseEventArgs e)
        {
            buttonImage.Image = Collapsed ? MediaGerbil.Properties.Resources.Down_1 : MediaGerbil.Properties.Resources.Up_1;
        }

        private void buttonImage_MouseClick(object sender, MouseEventArgs e)
        {
            Collapsed = !Collapsed;
            this.OnMouseClick(e);
        }
    }
}
